/*************************************************************************
	> File Name: P1030.cpp
	> Author: 
	> Mail: 
	> Created Time: 
 ************************************************************************/
#include <iostream>
using namespace std;
void tree(string a, string b) {
    if (a.size() == 0 || b.size() == 0) return;
    char ch = b[b.size() - 1];
    cout << ch;
    int root = a.find(ch);
    tree(a.substr(0, root), b.substr(0, root));
    tree(a.substr(root + 1), b.substr(root, b.size() - 1 - root));
    return ;
}

int main() {
    string str1, str2;
    cin >> str1 >> str2;
    tree(str1, str2);
    cout << endl;
    return 0;
}
